package com.wiboson.money.DataSource.model;

/**
 * Created by moon on 17/4/27.
 */
public class NowInfo {
    public char type;    //股票类型  1 - 上证指数 2 - 深证指数
    public int Num;   //股票号
    public String name;//名称
    public Float openPrice;//今日开盘价
    public Float closePrice;//收盘价
    public Float nowPrice;//当前价格
    public Float dayhighPrice;//当日最高
    public Float daylowPrice;//当日最低
    public Float buy1Price;//竞买价
    public Float sell1Price;//竞卖价
    public long VOL;//成交量
    public Double VOLAmount;//成交总金额
    public long buy1Count;//买一申请数
    public long sell1Count;//卖一申请数
    public Float buy2Price;//买2价
    public int buy2Count;//买2数量
    public Float sell2Price;//卖2价
    public int sell2Count;//买2数量
    public Float buy3Price;//买3价
    public int buy3Count;//买2数量
    public Float sell3Price;//卖3价
    public int sell3Count;//买2数量
    public Float buy4Price;//买4价
    public int buy4Count;//买2数量
    public Float sell4Price;//卖4价
    public int sell4Count;//买2数量
    public Float buy5Price;//买5价
    public int buy5Count;//买2数量
    public Float sell5Price;//卖5价
    public int sell5Count;//买2数量
    public String day;//日期
    public String time;//时间

    public char getType() {
        return type;
    }

    public void setType(char type) {
        this.type = type;
    }

    public int getNum() {
        return Num;
    }

    public void setNum(int num) {
        Num = num;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Float getOpenPrice() {
        return openPrice;
    }

    public void setOpenPrice(Float openPrice) {
        this.openPrice = openPrice;
    }

    public Float getClosePrice() {
        return closePrice;
    }

    public void setClosePrice(Float closePrice) {
        this.closePrice = closePrice;
    }

    public Float getNowPrice() {
        return nowPrice;
    }

    public void setNowPrice(Float nowPrice) {
        this.nowPrice = nowPrice;
    }

    public Float getDayhighPrice() {
        return dayhighPrice;
    }

    public void setDayhighPrice(Float dayhighPrice) {
        this.dayhighPrice = dayhighPrice;
    }

    public Float getDaylowPrice() {
        return daylowPrice;
    }

    public void setDaylowPrice(Float daylowPrice) {
        this.daylowPrice = daylowPrice;
    }

    public Float getBuy1Price() {
        return buy1Price;
    }

    public void setBuy1Price(Float buy1Price) {
        this.buy1Price = buy1Price;
    }

    public Float getSell1Price() {
        return sell1Price;
    }

    public void setSell1Price(Float sell1Price) {
        this.sell1Price = sell1Price;
    }

    public long getVOL() {
        return VOL;
    }

    public void setVOL(long VOL) {
        this.VOL = VOL;
    }

    public Double getVOLAmount() {
        return VOLAmount;
    }

    public void setVOLAmount(Double VOLAmount) {
        this.VOLAmount = VOLAmount;
    }

    public long getBuy1Count() {
        return buy1Count;
    }

    public void setBuy1Count(long buy1Count) {
        this.buy1Count = buy1Count;
    }

    public long getSell1Count() {
        return sell1Count;
    }

    public void setSell1Count(long sell1Count) {
        this.sell1Count = sell1Count;
    }

    public Float getBuy2Price() {
        return buy2Price;
    }

    public void setBuy2Price(Float buy2Price) {
        this.buy2Price = buy2Price;
    }

    public Float getSell2Price() {
        return sell2Price;
    }

    public void setSell2Price(Float sell2Price) {
        this.sell2Price = sell2Price;
    }

    public Float getBuy3Price() {
        return buy3Price;
    }

    public void setBuy3Price(Float buy3Price) {
        this.buy3Price = buy3Price;
    }

    public Float getSell3Price() {
        return sell3Price;
    }

    public void setSell3Price(Float sell3Price) {
        this.sell3Price = sell3Price;
    }

    public Float getBuy4Price() {
        return buy4Price;
    }

    public void setBuy4Price(Float buy4Price) {
        this.buy4Price = buy4Price;
    }

    public Float getSell4Price() {
        return sell4Price;
    }

    public void setSell4Price(Float sell4Price) {
        this.sell4Price = sell4Price;
    }

    public Float getBuy5Price() {
        return buy5Price;
    }

    public void setBuy5Price(Float buy5Price) {
        this.buy5Price = buy5Price;
    }

    public Float getSell5Price() {
        return sell5Price;
    }

    public void setSell5Price(Float sell5Price) {
        this.sell5Price = sell5Price;
    }

    public int getBuy2Count() {
        return buy2Count;
    }

    public void setBuy2Count(int buy2Count) {
        this.buy2Count = buy2Count;
    }

    public int getSell2Count() {
        return sell2Count;
    }

    public void setSell2Count(int sell2Count) {
        this.sell2Count = sell2Count;
    }

    public int getBuy3Count() {
        return buy3Count;
    }

    public void setBuy3Count(int buy3Count) {
        this.buy3Count = buy3Count;
    }

    public int getSell3Count() {
        return sell3Count;
    }

    public void setSell3Count(int sell3Count) {
        this.sell3Count = sell3Count;
    }

    public int getBuy4Count() {
        return buy4Count;
    }

    public void setBuy4Count(int buy4Count) {
        this.buy4Count = buy4Count;
    }

    public int getSell4Count() {
        return sell4Count;
    }

    public void setSell4Count(int sell4Count) {
        this.sell4Count = sell4Count;
    }

    public int getBuy5Count() {
        return buy5Count;
    }

    public void setBuy5Count(int buy5Count) {
        this.buy5Count = buy5Count;
    }

    public int getSell5Count() {
        return sell5Count;
    }

    public void setSell5Count(int sell5Count) {
        this.sell5Count = sell5Count;
    }

    public String getDay() {
        return day;
    }

    public void setDay(String day) {
        this.day = day;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    //从新浪数据初始化
    public NowInfo buildBySina(String data){
        //System.out.println(data);
        int i = 0;
        if ((i = data.indexOf("sh"))>0){
            type = '1';
        }else if ((i =data.indexOf("sz"))>0){
            type = '2';
        }
        Num = Integer.parseInt(data.substring(i+2,data.indexOf("=")));
        if (i > 0) {
            String info[] = data.substring(data.indexOf("\"")+1,data.lastIndexOf("\"")).split(",");
            name = info[0];
            openPrice = Float.parseFloat(info[1]);//今日开盘价
            closePrice = Float.parseFloat(info[2]);//收盘价
            nowPrice = Float.parseFloat(info[3]);//当前价格
            dayhighPrice = Float.parseFloat(info[4]);//当日最高
            daylowPrice = Float.parseFloat(info[5]);//当日最低
            buy1Price = Float.parseFloat(info[6]);//竞买价
            sell1Price = Float.parseFloat(info[7]);//竞卖价
            VOL = Long.parseLong(info[8]);//成交量
            VOLAmount = Double.parseDouble(info[9]);//成交总金额
            buy1Count = Integer.parseInt(info[10]);//买一申请数
            sell1Count = Integer.parseInt(info[20]);//卖一申请数

            buy2Price = Float.parseFloat(info[13]);//买2价
            buy2Count = Integer.parseInt(info[12]);
            sell2Price = Float.parseFloat(info[23]);//卖2价
            sell2Count = Integer.parseInt(info[22]);
            buy3Price = Float.parseFloat(info[15]);//买3价
            buy3Count = Integer.parseInt(info[14]);
            sell3Price = Float.parseFloat(info[25]);//卖3价
            sell3Count = Integer.parseInt(info[24]);
            buy4Price = Float.parseFloat(info[17]);//买4价
            buy4Count = Integer.parseInt(info[16]);
            sell4Price = Float.parseFloat(info[27]);//卖4价
            sell4Count = Integer.parseInt(info[26]);
            buy5Price = Float.parseFloat(info[19]);//买5价
            buy5Count = Integer.parseInt(info[18]);
            sell5Price = Float.parseFloat(info[29]);//卖5价
            sell5Count = Integer.parseInt(info[28]);

            day = info[30];//日期
            time = info[31]+","+info[32];//时间


            return this;
        }
        return null;
    }

    @Override
    public String toString(){
        return "股票类型:"+type+
                "\n开盘价:"+openPrice+
                "\n收盘价:"+closePrice+
                "\n当前价格:"+nowPrice+
                "\n今日最高价:"+dayhighPrice+
                "\n今日最低价"+daylowPrice+
                "\n竞买价:"+buy1Price+
                "\n竞买数量:"+buy1Count+
                "\n竞卖价:"+sell1Price+
                "\n竞卖数量:"+sell1Count+
                "\n成交量:"+VOL+
                "\n成交金额:"+VOLAmount+
                "\n买二额:"+buy2Price+
                "\n买二量:"+buy2Count+
                "\n买三额:"+buy3Price+
                "\n买三量:"+buy3Count+
                "\n买四额:"+buy4Price+
                "\n买四量:"+buy4Count+
                "\n买五额:"+buy5Price+
                "\n买五量:"+buy5Count+
                "\n卖二额:"+sell2Price+
                "\n卖二量:"+sell2Count+
                "\n卖三额:"+sell3Price+
                "\n卖三量:"+sell3Count+
                "\n卖四额:"+sell4Price+
                "\n卖四量:"+sell4Count+
                "\n卖五额:"+sell5Price+
                "\n卖五量:"+sell5Count+
                "\n日期:"+day+
                "\n时间:"+time;
    }
}
